/* 
 *  Copyright (c) 2011—2013 Panguso.com. All rights reserved. 
 *  File Name:  NoiseIdentify1.java                                      
 *  File Contents Outline :  检测过滤规则1                  
 *  File  Create Date:   2012年7月30日
 *  File Version#: Revision#: #1                  
 *  File  Latest Modify Date : 2013年1月16日
 *  File Author :  bachuan@panguso.com
 */
/*

 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cn.edu.thu.log.clean;

import cn.edu.thu.log.read.LogBuffer;
import cn.edu.thu.log.tree.CalculateTree;
import cn.edu.thu.log.tree.ManyTree;
import cn.edu.thu.log.web.service.LogCleanConfigReadService;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Map;

/**
 *
 * @author wan
 */
public class NoiseIdentify1 {
    
    private ManyTree manyTree;
    private String min;
    private String max;
    // private int flag=1;//默认符合格式要求
    private ArrayList<String> headtagList;
    private Map<String, String> bodytagMap; 
    private CalculateTree calculate;
    private String classifyTags;
//    private ArrayList<String> classifyArrayList;
//    private LogBuffer record;
//    private CalculateTree calculate;  
    //time
    long time_calculatetree=0;
            
    public void readNoiseIdetifyConfigFile(LogCleanConfigReadService readLogCleanConfigService ){
        System.out.println("begin Read NoiseIdentifyConfigFile and build tree!");
        readLogCleanConfigService.readNoiseConfig();
        manyTree = readLogCleanConfigService.getManyTree();
//        min = readLogCleanConfigService.getMin();
//        max = readLogCleanConfigService.getMax();
        classifyTags=readLogCleanConfigService.getClassifyTags();      
        calculate= new CalculateTree(classifyTags);
    }
    
    public boolean logNoise(LogBuffer record) throws IOException{ 
       

        boolean result = calculate.calculateTree(manyTree.getRoot(),record);
       
        return result;
    }
}
